
import Mock from 'mockjs'

class mockjs {
    constructor () {
        Mock.setup({
            timeout: '200-600' // 表示响应时间介于 200 和 600 毫秒之间，默认值是'10-100'。
        })
        this.init()
    }
    getPath (path:string) :string{
        return '/mock' + path
    }
    init () {
        console.log("init mock")
        Mock.mock(this.getPath('/login'), 'post', (option:any) => {
            console.log("option:", option)
            return {
               code: 0,
               data: {
                   token: 'aabbccddeeff',
                   username: 'admin',
               }
            }
        })
    }
}

export default new mockjs()